<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>api_shim.core.javautils</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;api_shim ::
        <a href="api_shim.core-module.html">Package&nbsp;core</a> ::
        Module&nbsp;javautils
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="api_shim.core.javautils-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="api_shim.core.javautils-module.html">Module api_shim.core.javautils</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># Copyright 2011-2012 the original author or authors.</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Licensed under the Apache License, Version 2.0 (the "License");</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># you may not use this file except in compliance with the License.</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># You may obtain a copy of the License at</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#      http://www.apache.org/licenses/LICENSE-2.0</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Unless required by applicable law or agreed to in writing, software</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># distributed under the License is distributed on an "AS IS" BASIS,</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># See the License for the specific language governing permissions and</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># limitations under the License.</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">""" </tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">This module defines several functions to ease interfacing with Java code.  </tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring">Initially based on resources in the following article http://www.ibm.com/developerworks/java/tutorials/j-jython2/index.html</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">types</tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">java</tt> <tt class="py-keyword">import</tt> <tt class="py-name">util</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-name">__author__</tt> <tt class="py-op">=</tt> <tt class="py-string">"Scott Horn"</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable api_shim.core.buffer.__email__=api_shim.core.buffer-module.html#__email__,Variable api_shim.core.event_bus.__email__=api_shim.core.event_bus-module.html#__email__,Variable api_shim.core.file_system.__email__=api_shim.core.file_system-module.html#__email__,Variable api_shim.core.handlers.__email__=api_shim.core.handlers-module.html#__email__,Variable api_shim.core.http.__email__=api_shim.core.http-module.html#__email__,Variable api_shim.core.javautils.__email__=api_shim.core.javautils-module.html#__email__,Variable api_shim.core.net.__email__=api_shim.core.net-module.html#__email__,Variable api_shim.core.parsetools.__email__=api_shim.core.parsetools-module.html#__email__,Variable api_shim.core.shared_data.__email__=api_shim.core.shared_data-module.html#__email__,Variable api_shim.core.sock_js.__email__=api_shim.core.sock_js-module.html#__email__,Variable api_shim.core.ssl_support.__email__=api_shim.core.ssl_support-module.html#__email__,Variable api_shim.core.streams.__email__=api_shim.core.streams-module.html#__email__,Variable api_shim.core.tcp_support.__email__=api_shim.core.tcp_support-module.html#__email__,Variable api_shim.vertx.__email__=api_shim.vertx-module.html#__email__"><a title="api_shim.core.buffer.__email__
api_shim.core.event_bus.__email__
api_shim.core.file_system.__email__
api_shim.core.handlers.__email__
api_shim.core.http.__email__
api_shim.core.javautils.__email__
api_shim.core.net.__email__
api_shim.core.parsetools.__email__
api_shim.core.shared_data.__email__
api_shim.core.sock_js.__email__
api_shim.core.ssl_support.__email__
api_shim.core.streams.__email__
api_shim.core.tcp_support.__email__
api_shim.vertx.__email__" class="py-name" href="#" onclick="return doclink('link-0', '__email__', 'link-0');">__email__</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"scott@hornmicro.com"</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt id="link-1" class="py-name" targets="Variable api_shim.core.buffer.__credits__=api_shim.core.buffer-module.html#__credits__,Variable api_shim.core.event_bus.__credits__=api_shim.core.event_bus-module.html#__credits__,Variable api_shim.core.file_system.__credits__=api_shim.core.file_system-module.html#__credits__,Variable api_shim.core.handlers.__credits__=api_shim.core.handlers-module.html#__credits__,Variable api_shim.core.http.__credits__=api_shim.core.http-module.html#__credits__,Variable api_shim.core.javautils.__credits__=api_shim.core.javautils-module.html#__credits__,Variable api_shim.core.net.__credits__=api_shim.core.net-module.html#__credits__,Variable api_shim.core.parsetools.__credits__=api_shim.core.parsetools-module.html#__credits__,Variable api_shim.core.shared_data.__credits__=api_shim.core.shared_data-module.html#__credits__,Variable api_shim.core.sock_js.__credits__=api_shim.core.sock_js-module.html#__credits__,Variable api_shim.core.ssl_support.__credits__=api_shim.core.ssl_support-module.html#__credits__,Variable api_shim.core.streams.__credits__=api_shim.core.streams-module.html#__credits__,Variable api_shim.core.tcp_support.__credits__=api_shim.core.tcp_support-module.html#__credits__,Variable api_shim.vertx.__credits__=api_shim.vertx-module.html#__credits__"><a title="api_shim.core.buffer.__credits__
api_shim.core.event_bus.__credits__
api_shim.core.file_system.__credits__
api_shim.core.handlers.__credits__
api_shim.core.http.__credits__
api_shim.core.javautils.__credits__
api_shim.core.net.__credits__
api_shim.core.parsetools.__credits__
api_shim.core.shared_data.__credits__
api_shim.core.sock_js.__credits__
api_shim.core.ssl_support.__credits__
api_shim.core.streams.__credits__
api_shim.core.tcp_support.__credits__
api_shim.vertx.__credits__" class="py-name" href="#" onclick="return doclink('link-1', '__credits__', 'link-1');">__credits__</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"Based entirely on work by Tim Fox http://tfox.org"</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"> </tt>
<a name="map_map_from_java"></a><div id="map_map_from_java-def"><a name="L30"></a><tt class="py-lineno"> 30</tt> <a class="py-toggle" href="#" id="map_map_from_java-toggle" onclick="return toggle('map_map_from_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_map_from_java">map_map_from_java</a> <tt class="py-op">(</tt><tt class="py-param">map</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_map_from_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_map_from_java-expanded"><a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a Map to a Dictionary. """</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">    <tt class="py-name">iter</tt> <tt class="py-op">=</tt> <tt class="py-name">map</tt><tt class="py-op">.</tt><tt class="py-name">keySet</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">iterator</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">    <tt class="py-keyword">while</tt> <tt class="py-name">iter</tt><tt class="py-op">.</tt><tt class="py-name">hasNext</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">        <tt class="py-name">key</tt> <tt class="py-op">=</tt> <tt class="py-name">iter</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">[</tt><tt id="link-2" class="py-name" targets="Function api_shim.core.javautils.map_from_java()=api_shim.core.javautils-module.html#map_from_java"><a title="api_shim.core.javautils.map_from_java" class="py-name" href="#" onclick="return doclink('link-2', 'map_from_java', 'link-2');">map_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-3" class="py-name"><a title="api_shim.core.javautils.map_from_java" class="py-name" href="#" onclick="return doclink('link-3', 'map_from_java', 'link-2');">map_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">map</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method api_shim.core.http.HttpClient.get()=api_shim.core.http.HttpClient-class.html#get,Method api_shim.core.http.RouteMatcher.get()=api_shim.core.http.RouteMatcher-class.html#get"><a title="api_shim.core.http.HttpClient.get
api_shim.core.http.RouteMatcher.get" class="py-name" href="#" onclick="return doclink('link-4', 'get', 'link-4');">get</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"> </tt>
<a name="map_set_from_java"></a><div id="map_set_from_java-def"><a name="L39"></a><tt class="py-lineno"> 39</tt> <a class="py-toggle" href="#" id="map_set_from_java-toggle" onclick="return toggle('map_set_from_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_set_from_java">map_set_from_java</a> <tt class="py-op">(</tt><tt class="py-param">set_</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_set_from_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_set_from_java-expanded"><a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a Set to a set. """</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-5" class="py-name" targets="Method api_shim.core.http.MultiMap.set()=api_shim.core.http.MultiMap-class.html#set"><a title="api_shim.core.http.MultiMap.set" class="py-name" href="#" onclick="return doclink('link-5', 'set', 'link-5');">set</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">    <tt class="py-name">iter</tt> <tt class="py-op">=</tt> <tt class="py-name">set_</tt><tt class="py-op">.</tt><tt class="py-name">iterator</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">    <tt class="py-keyword">while</tt> <tt class="py-name">iter</tt><tt class="py-op">.</tt><tt class="py-name">hasNext</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Method api_shim.core.http.MultiMap.add()=api_shim.core.http.MultiMap-class.html#add,Method api_shim.core.shared_data.SharedSet.add()=api_shim.core.shared_data.SharedSet-class.html#add"><a title="api_shim.core.http.MultiMap.add
api_shim.core.shared_data.SharedSet.add" class="py-name" href="#" onclick="return doclink('link-6', 'add', 'link-6');">add</a></tt><tt class="py-op">(</tt><tt id="link-7" class="py-name"><a title="api_shim.core.javautils.map_from_java" class="py-name" href="#" onclick="return doclink('link-7', 'map_from_java', 'link-2');">map_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">iter</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
<a name="map_collection_from_java"></a><div id="map_collection_from_java-def"><a name="L47"></a><tt class="py-lineno"> 47</tt> <a class="py-toggle" href="#" id="map_collection_from_java-toggle" onclick="return toggle('map_collection_from_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_collection_from_java">map_collection_from_java</a> <tt class="py-op">(</tt><tt class="py-param">coll</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_collection_from_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_collection_from_java-expanded"><a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a Collection to a List. """</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">    <tt class="py-name">iter</tt> <tt class="py-op">=</tt> <tt class="py-name">coll</tt><tt class="py-op">.</tt><tt class="py-name">iterator</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">    <tt class="py-keyword">while</tt> <tt class="py-name">iter</tt><tt class="py-op">.</tt><tt class="py-name">hasNext</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt id="link-8" class="py-name"><a title="api_shim.core.javautils.map_from_java" class="py-name" href="#" onclick="return doclink('link-8', 'map_from_java', 'link-2');">map_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">iter</tt><tt class="py-op">.</tt><tt class="py-name">next</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"> </tt>
<a name="map_from_java"></a><div id="map_from_java-def"><a name="L55"></a><tt class="py-lineno"> 55</tt> <a class="py-toggle" href="#" id="map_from_java-toggle" onclick="return toggle('map_from_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_from_java">map_from_java</a> <tt class="py-op">(</tt><tt class="py-param">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_from_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_from_java-expanded"><a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a Java type to a Jython type. """</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">object</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">object</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt>   <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">,</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">Map</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>        <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-9" class="py-name" targets="Function api_shim.core.javautils.map_map_from_java()=api_shim.core.javautils-module.html#map_map_from_java"><a title="api_shim.core.javautils.map_map_from_java" class="py-name" href="#" onclick="return doclink('link-9', 'map_map_from_java', 'link-9');">map_map_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">,</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">Set</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>        <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-10" class="py-name" targets="Function api_shim.core.javautils.map_set_from_java()=api_shim.core.javautils-module.html#map_set_from_java"><a title="api_shim.core.javautils.map_set_from_java" class="py-name" href="#" onclick="return doclink('link-10', 'map_set_from_java', 'link-10');">map_set_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">,</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">Collection</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-11" class="py-name" targets="Function api_shim.core.javautils.map_collection_from_java()=api_shim.core.javautils-module.html#map_collection_from_java"><a title="api_shim.core.javautils.map_collection_from_java" class="py-name" href="#" onclick="return doclink('link-11', 'map_collection_from_java', 'link-11');">map_collection_from_java</a></tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt>                                     <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">object</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"> </tt>
<a name="map_seq_to_java"></a><div id="map_seq_to_java-def"><a name="L64"></a><tt class="py-lineno"> 64</tt> <a class="py-toggle" href="#" id="map_seq_to_java-toggle" onclick="return toggle('map_seq_to_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_seq_to_java">map_seq_to_java</a> <tt class="py-op">(</tt><tt class="py-param">seq</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_seq_to_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_seq_to_java-expanded"><a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a seqence to a Java ArrayList. """</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">ArrayList</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">seq</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">e</tt> <tt class="py-keyword">in</tt> <tt class="py-name">seq</tt><tt class="py-op">:</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="api_shim.core.http.MultiMap.add
api_shim.core.shared_data.SharedSet.add" class="py-name" href="#" onclick="return doclink('link-12', 'add', 'link-6');">add</a></tt><tt class="py-op">(</tt><tt id="link-13" class="py-name" targets="Function api_shim.core.javautils.map_to_java()=api_shim.core.javautils-module.html#map_to_java"><a title="api_shim.core.javautils.map_to_java" class="py-name" href="#" onclick="return doclink('link-13', 'map_to_java', 'link-13');">map_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"> </tt>
<a name="map_list_to_java"></a><div id="map_list_to_java-def"><a name="L71"></a><tt class="py-lineno"> 71</tt> <a class="py-toggle" href="#" id="map_list_to_java-toggle" onclick="return toggle('map_list_to_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_list_to_java">map_list_to_java</a> <tt class="py-op">(</tt><tt class="py-param">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_list_to_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_list_to_java-expanded"><a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a List to a Java ArrayList. """</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">ArrayList</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">e</tt> <tt class="py-keyword">in</tt> <tt class="py-name">list</tt><tt class="py-op">:</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="api_shim.core.http.MultiMap.add
api_shim.core.shared_data.SharedSet.add" class="py-name" href="#" onclick="return doclink('link-14', 'add', 'link-6');">add</a></tt><tt class="py-op">(</tt><tt id="link-15" class="py-name"><a title="api_shim.core.javautils.map_to_java" class="py-name" href="#" onclick="return doclink('link-15', 'map_to_java', 'link-13');">map_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"> </tt>
<a name="map_list_to_java_vector"></a><div id="map_list_to_java_vector-def"><a name="L78"></a><tt class="py-lineno"> 78</tt> <a class="py-toggle" href="#" id="map_list_to_java_vector-toggle" onclick="return toggle('map_list_to_java_vector');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_list_to_java_vector">map_list_to_java_vector</a> <tt class="py-op">(</tt><tt class="py-param">list</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_list_to_java_vector-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_list_to_java_vector-expanded"><a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a List to a Java Vector. """</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">Vector</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">e</tt> <tt class="py-keyword">in</tt> <tt class="py-name">list</tt><tt class="py-op">:</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="api_shim.core.http.MultiMap.add
api_shim.core.shared_data.SharedSet.add" class="py-name" href="#" onclick="return doclink('link-16', 'add', 'link-6');">add</a></tt><tt class="py-op">(</tt><tt id="link-17" class="py-name"><a title="api_shim.core.javautils.map_to_java" class="py-name" href="#" onclick="return doclink('link-17', 'map_to_java', 'link-13');">map_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"> </tt>
<a name="map_dict_to_java"></a><div id="map_dict_to_java-def"><a name="L85"></a><tt class="py-lineno"> 85</tt> <a class="py-toggle" href="#" id="map_dict_to_java-toggle" onclick="return toggle('map_dict_to_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_dict_to_java">map_dict_to_java</a> <tt class="py-op">(</tt><tt class="py-param">dict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_dict_to_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_dict_to_java-expanded"><a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a Dictionary to a Java HashMap. """</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">util</tt><tt class="py-op">.</tt><tt class="py-name">HashMap</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt> <tt class="py-keyword">in</tt> <tt class="py-name">dict</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method api_shim.core.shared_data.SharedHash.items()=api_shim.core.shared_data.SharedHash-class.html#items"><a title="api_shim.core.shared_data.SharedHash.items" class="py-name" href="#" onclick="return doclink('link-18', 'items', 'link-18');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method api_shim.core.http.HttpClient.put()=api_shim.core.http.HttpClient-class.html#put,Method api_shim.core.http.RouteMatcher.put()=api_shim.core.http.RouteMatcher-class.html#put"><a title="api_shim.core.http.HttpClient.put
api_shim.core.http.RouteMatcher.put" class="py-name" href="#" onclick="return doclink('link-19', 'put', 'link-19');">put</a></tt><tt class="py-op">(</tt><tt id="link-20" class="py-name"><a title="api_shim.core.javautils.map_to_java" class="py-name" href="#" onclick="return doclink('link-20', 'map_to_java', 'link-13');">map_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">key</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-21" class="py-name"><a title="api_shim.core.javautils.map_to_java" class="py-name" href="#" onclick="return doclink('link-21', 'map_to_java', 'link-13');">map_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">value</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"> </tt>
<a name="map_to_java"></a><div id="map_to_java-def"><a name="L92"></a><tt class="py-lineno"> 92</tt> <a class="py-toggle" href="#" id="map_to_java-toggle" onclick="return toggle('map_to_java');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="api_shim.core.javautils-module.html#map_to_java">map_to_java</a> <tt class="py-op">(</tt><tt class="py-param">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="map_to_java-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="map_to_java-expanded"><a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">    <tt class="py-docstring">""" Convert a Jython type to a Java type. """</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">object</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">object</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">    <tt class="py-name">t</tt> <tt class="py-op">=</tt> <tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt>   <tt class="py-name">t</tt> <tt class="py-op">==</tt> <tt class="py-name">TupleType</tt><tt class="py-op">:</tt> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-22" class="py-name" targets="Function api_shim.core.javautils.map_seq_to_java()=api_shim.core.javautils-module.html#map_seq_to_java"><a title="api_shim.core.javautils.map_seq_to_java" class="py-name" href="#" onclick="return doclink('link-22', 'map_seq_to_java', 'link-22');">map_seq_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">t</tt> <tt class="py-op">==</tt> <tt class="py-name">ListType</tt><tt class="py-op">:</tt>  <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-23" class="py-name"><a title="api_shim.core.javautils.map_seq_to_java" class="py-name" href="#" onclick="return doclink('link-23', 'map_seq_to_java', 'link-22');">map_seq_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">t</tt> <tt class="py-op">==</tt> <tt class="py-name">DictType</tt><tt class="py-op">:</tt>  <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-24" class="py-name" targets="Function api_shim.core.javautils.map_dict_to_java()=api_shim.core.javautils-module.html#map_dict_to_java"><a title="api_shim.core.javautils.map_dict_to_java" class="py-name" href="#" onclick="return doclink('link-24', 'map_dict_to_java', 'link-24');">map_dict_to_java</a></tt><tt class="py-op">(</tt><tt class="py-name">object</tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt>                <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">object</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    on Wed Jul 17 20:25:01 2013
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>